package com.ceshiren.mini.converter;


import com.ceshiren.mini.dto.PlanDTO;
import com.ceshiren.mini.dto.PlanTestCasesDTO;
import com.ceshiren.mini.dto.TestCaseDTO;
import com.ceshiren.mini.entity.Plan;
import com.ceshiren.mini.entity.Testcase;
import io.swagger.annotations.ApiModelProperty;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.springframework.stereotype.Repository;

import java.util.List;

//生成的映射器是一个单例范围的 Spring bean，可以通过以下方式检索@Autowired
@Repository
@Mapper(componentModel = "spring")
public interface PlanConverter {

    @Mappings({
            @Mapping(target = "id",source = "id"),
            @Mapping(target = "name",source = "name")
    })
    Plan planDTOForplan(PlanDTO planDTO);

    @Mappings({
            @Mapping(target = "id",source = "id"),
            @Mapping(target = "name",source = "name")
    })
    PlanDTO planForplanDTO(Plan plan);

    @Mappings({
            @Mapping(target = "id",source = "id"),
            @Mapping(target = "name",source = "name")
    })
    PlanTestCasesDTO planForPlanTestCasesDTO(Plan plan);

    @Mappings({
            @Mapping(target = "id",source = "id"),
            @Mapping(target = "name",source = "name")
    })
    Plan planTestCasesDTOForPlan(PlanTestCasesDTO  planTestCasesDTO);

    List<TestCaseDTO> testCaseListForTestCaseDTOList(List<Testcase> testCaseList);

}
